package com.yjc.springcloud.alibaba.service.impl;

import com.yjc.springcloud.alibaba.mapper.AccountMapper;
import com.yjc.springcloud.alibaba.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.concurrent.TimeUnit;

/**
 * @author shkstart
 * @create 2022-08-18 8:41
 */
@Service
public class AccountServiceImpl implements AccountService {
    @Autowired
    AccountMapper accountMapper;

    @Override
    public void decreaseAccount(Long userId, BigDecimal money) throws InterruptedException {

        TimeUnit.MILLISECONDS.sleep(20000);

        accountMapper.reduceAccount(userId, money);
    }
}
